package com.thssh.ui.lsn03.activity;

import android.os.CountDownTimer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.thssh.ui.R;
import com.thssh.ui.lsn03.view.CircleProgressView;

import java.util.Timer;
import java.util.TimerTask;

public class PaintTextActivity extends AppCompatActivity {

    private CircleProgressView circle_progress_view;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_paint_text);
        circle_progress_view = (CircleProgressView) findViewById(R.id.circle_progress_view);
    }

    public void showWaitingClick(View view) {
        circle_progress_view.showWaiting();
    }

    public void showProgressClick(View view) {
        circle_progress_view.showProgress();
        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            int counter = 0;
            @Override
            public void run() {
                if(counter > 100){
                    cancel();
                }
                circle_progress_view.setProgress(counter++);
            }
        }, 0, 100);
    }
}
